(defun dai-insert-p-tag ()
  "插入p标签"
  (interactive)
  (insert "<p></p>")
  (backward-char 4))


(defun dai-wrap-markup-region()
  "给mark文字区域插入<b></b>"
  (interactive)
  (progn
    (save-excursion
      (goto-char (region-end))
      (insert "</b>")
      (goto-char (region-beginning))
      (insert "<b>"))
    )
  )


(defun dai-select-current-word ()
  "选中当前位置的词"
  (interactive)
  (let (pt)
    (skip-chars-backward "-A-Za-z0-9")
    (setq pt (point))
    (skip-chars-forward "-A-Za-z0-9")
    (set-mark pt))
  )


(defun dai-select-cur-line()
  "选中当前行"
  (interactive)
  (let ((pos (line-beginning-position)))
    (end-of-line)
    (set-mark pos)))


(defun dai-delete-curent-file()
  "删除当前文件"
  (interactive)
  (let ((curFile (buffer-file-name)))
	(when (yes-or-no-p (concat "Delete File?: " curFile))
	  (kill-buffer (current-buffer))
	  (when curFile
	    (delete-file curFile)))))


(defun dai-kill-enclosed-text()
  "删除括号内的字符"
  (interactive)
  (save-excursion
    (let (p1 p2)
      (search-backward "(")
      (setq p1 (point))
      (message "p1 is %d" p1)
      (search-forward ")")
      (setq p2 (point))
      (message "p2 is %d" p2)
      (kill-region (1+ p1) (1- p2))
      )
    )
  )

(defun dai-cur-text()
  (interactive)
  (let (str)
    (setq str (thing-at-point 'filename))
    str
    ))
